﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_RptNhapXuatTonKho : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboDonVi")]
        private ComboBox _CboDonVi;
        [AccessedThroughProperty("CboKhoHang")]
        private ComboBox _CboKhoHang;
        [AccessedThroughProperty("CboNhomHang")]
        private ComboBox _CboNhomHang;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("GroupBox1")]
        private GroupBox _GroupBox1;
        [AccessedThroughProperty("GroupBox2")]
        private GroupBox _GroupBox2;
        [AccessedThroughProperty("GroupBox3")]
        private GroupBox _GroupBox3;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label13")]
        private Label _Label13;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Label3")]
        private Label _Label3;
        [AccessedThroughProperty("Label4")]
        private Label _Label4;
        [AccessedThroughProperty("OptDayDu")]
        private RadioButton _OptDayDu;
        [AccessedThroughProperty("OptSoLuong")]
        private RadioButton _OptSoLuong;
        [AccessedThroughProperty("RbNhomTheoHangHoa")]
        private RadioButton _RbNhomTheoHangHoa;
        [AccessedThroughProperty("RbNhomTheoKho")]
        private RadioButton _RbNhomTheoKho;
        [AccessedThroughProperty("TxtDenNgay")]
        private DateTimePicker _TxtDenNgay;
        [AccessedThroughProperty("TxtTuNgay")]
        private DateTimePicker _TxtTuNgay;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private clsNhapKho objPNK;

        public Frm_RptNhapXuatTonKho()
        {
            base.Load += new EventHandler(this.Frm_RptNhapXuatTonKho_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.objPNK = new clsNhapKho();
            this.InitializeComponent();
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            if (this.RbNhomTheoKho.Checked & !this.RbNhomTheoHangHoa.Checked)
            {
                this.PrintReportTheoNhomKho();
            }
            if (!this.RbNhomTheoKho.Checked & this.RbNhomTheoHangHoa.Checked)
            {
                this.PrintReportTheoNhomHangHoa();
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_RptNhapXuatTonKho_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                BuildComboModule.BuildCombo(this.CboDonVi, modGeneral.ListDanhMuc.DonVi, true, "", "");
                this.CboDonVi.SelectedValue = modGeneral.H_CLIENT;
                BuildComboModule.BuildCombo(this.CboNhomHang, modGeneral.ListDanhMuc.NhomHangHoa, false, "", "");
                BuildComboModule.BuildCombo(this.CboKhoHang, modGeneral.ListDanhMuc.KhoHang, false, "", "");
                this.TxtTuNgay.Text = "01/" + LVYModule.sRight("00" + Conversions.ToString(DateAndTime.Month(DateAndTime.Today)), 2) + "/" + Conversions.ToString(DateAndTime.Year(DateAndTime.Today));
            }
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_RptNhapXuatTonKho));
            this.GroupBox1 = new GroupBox();
            this.GroupBox3 = new GroupBox();
            this.OptSoLuong = new RadioButton();
            this.OptDayDu = new RadioButton();
            this.GroupBox2 = new GroupBox();
            this.RbNhomTheoHangHoa = new RadioButton();
            this.RbNhomTheoKho = new RadioButton();
            this.Label4 = new Label();
            this.CboDonVi = new ComboBox();
            this.CboKhoHang = new ComboBox();
            this.CboNhomHang = new ComboBox();
            this.Label2 = new Label();
            this.Label1 = new Label();
            this.Label3 = new Label();
            this.Label13 = new Label();
            this.TxtDenNgay = new DateTimePicker();
            this.TxtTuNgay = new DateTimePicker();
            this.CmdCancel = new Button();
            this.CmdOK = new Button();
            this.GroupBox1.SuspendLayout();
            this.GroupBox3.SuspendLayout();
            this.GroupBox2.SuspendLayout();
            this.SuspendLayout();
            this.GroupBox1.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            this.GroupBox1.Controls.Add(this.GroupBox3);
            this.GroupBox1.Controls.Add(this.GroupBox2);
            this.GroupBox1.Controls.Add(this.Label4);
            this.GroupBox1.Controls.Add(this.CboDonVi);
            this.GroupBox1.Controls.Add(this.CboKhoHang);
            this.GroupBox1.Controls.Add(this.CboNhomHang);
            this.GroupBox1.Controls.Add(this.Label2);
            this.GroupBox1.Controls.Add(this.Label1);
            this.GroupBox1.Controls.Add(this.Label3);
            this.GroupBox1.Controls.Add(this.Label13);
            this.GroupBox1.Controls.Add(this.TxtDenNgay);
            this.GroupBox1.Controls.Add(this.TxtTuNgay);
            Point point = new Point(2, 6);
            this.GroupBox1.Location = point;
            this.GroupBox1.Name = "GroupBox1";
            Size size = new Size(370, 0xcd);
            this.GroupBox1.Size = size;
            this.GroupBox1.TabIndex = 0;
            this.GroupBox1.TabStop = false;
            this.GroupBox1.Text = "T\x00f9y chọn";
            this.GroupBox3.BackgroundImage = (Image) manager.GetObject("GroupBox3.BackgroundImage");
            this.GroupBox3.Controls.Add(this.OptSoLuong);
            this.GroupBox3.Controls.Add(this.OptDayDu);
            point = new Point(0xc5, 0x83);
            this.GroupBox3.Location = point;
            this.GroupBox3.Name = "GroupBox3";
            size = new Size(0xa5, 0x3f);
            this.GroupBox3.Size = size;
            this.GroupBox3.TabIndex = 0x38;
            this.GroupBox3.TabStop = false;
            this.OptSoLuong.AutoSize = true;
            this.OptSoLuong.BackColor = Color.Transparent;
            point = new Point(15, 0x26);
            this.OptSoLuong.Location = point;
            this.OptSoLuong.Name = "OptSoLuong";
            size = new Size(0x92, 0x11);
            this.OptSoLuong.Size = size;
            this.OptSoLuong.TabIndex = 0x36;
            this.OptSoLuong.Text = "In tổng hợp theo số lượng";
            this.OptSoLuong.UseVisualStyleBackColor = false;
            this.OptDayDu.AutoSize = true;
            this.OptDayDu.BackColor = Color.Transparent;
            this.OptDayDu.Checked = true;
            point = new Point(15, 15);
            this.OptDayDu.Location = point;
            this.OptDayDu.Name = "OptDayDu";
            size = new Size(0x47, 0x11);
            this.OptDayDu.Size = size;
            this.OptDayDu.TabIndex = 0x35;
            this.OptDayDu.TabStop = true;
            this.OptDayDu.Text = "In đầy đủ";
            this.OptDayDu.UseVisualStyleBackColor = false;
            this.GroupBox2.BackgroundImage = (Image) manager.GetObject("GroupBox2.BackgroundImage");
            this.GroupBox2.Controls.Add(this.RbNhomTheoHangHoa);
            this.GroupBox2.Controls.Add(this.RbNhomTheoKho);
            point = new Point(10, 0x83);
            this.GroupBox2.Location = point;
            this.GroupBox2.Name = "GroupBox2";
            size = new Size(0xac, 0x3f);
            this.GroupBox2.Size = size;
            this.GroupBox2.TabIndex = 0x37;
            this.GroupBox2.TabStop = false;
            this.RbNhomTheoHangHoa.AutoSize = true;
            this.RbNhomTheoHangHoa.BackColor = Color.Transparent;
            point = new Point(15, 0x26);
            this.RbNhomTheoHangHoa.Location = point;
            this.RbNhomTheoHangHoa.Name = "RbNhomTheoHangHoa";
            size = new Size(0x8e, 0x11);
            this.RbNhomTheoHangHoa.Size = size;
            this.RbNhomTheoHangHoa.TabIndex = 0x36;
            this.RbNhomTheoHangHoa.Text = "Tổng hợp theo mặt h\x00e0ng";
            this.RbNhomTheoHangHoa.UseVisualStyleBackColor = false;
            this.RbNhomTheoKho.AutoSize = true;
            this.RbNhomTheoKho.BackColor = Color.Transparent;
            this.RbNhomTheoKho.Checked = true;
            point = new Point(15, 15);
            this.RbNhomTheoKho.Location = point;
            this.RbNhomTheoKho.Name = "RbNhomTheoKho";
            size = new Size(0x74, 0x11);
            this.RbNhomTheoKho.Size = size;
            this.RbNhomTheoKho.TabIndex = 0x35;
            this.RbNhomTheoKho.TabStop = true;
            this.RbNhomTheoKho.Text = "Tổng hợp theo kho";
            this.RbNhomTheoKho.UseVisualStyleBackColor = false;
            this.Label4.AutoSize = true;
            this.Label4.BackColor = Color.Transparent;
            point = new Point(0x15, 0x16);
            this.Label4.Location = point;
            this.Label4.Name = "Label4";
            size = new Size(0x26, 13);
            this.Label4.Size = size;
            this.Label4.TabIndex = 0x36;
            this.Label4.Text = "Đơn vị";
            this.CboDonVi.FormattingEnabled = true;
            point = new Point(90, 0x13);
            this.CboDonVi.Location = point;
            this.CboDonVi.Name = "CboDonVi";
            size = new Size(0x10f, 0x15);
            this.CboDonVi.Size = size;
            this.CboDonVi.TabIndex = 0x35;
            this.CboKhoHang.FormattingEnabled = true;
            point = new Point(90, 0x68);
            this.CboKhoHang.Location = point;
            this.CboKhoHang.Name = "CboKhoHang";
            size = new Size(0x10f, 0x15);
            this.CboKhoHang.Size = size;
            this.CboKhoHang.TabIndex = 50;
            this.CboNhomHang.FormattingEnabled = true;
            point = new Point(90, 0x4b);
            this.CboNhomHang.Location = point;
            this.CboNhomHang.Name = "CboNhomHang";
            size = new Size(0x10f, 0x15);
            this.CboNhomHang.Size = size;
            this.CboNhomHang.TabIndex = 0x31;
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            point = new Point(0x15, 0x6b);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x35, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x30;
            this.Label2.Text = "Kho h\x00e0ng";
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            point = new Point(0x15, 0x4e);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x3e, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0x2f;
            this.Label1.Text = "Nh\x00f3m h\x00e0ng";
            this.Label3.AutoSize = true;
            this.Label3.BackColor = Color.Transparent;
            point = new Point(0xc2, 50);
            this.Label3.Location = point;
            this.Label3.Name = "Label3";
            size = new Size(0x35, 13);
            this.Label3.Size = size;
            this.Label3.TabIndex = 0x2f;
            this.Label3.Text = "Đến ng\x00e0y";
            this.Label13.AutoSize = true;
            this.Label13.BackColor = Color.Transparent;
            point = new Point(0x15, 50);
            this.Label13.Location = point;
            this.Label13.Name = "Label13";
            size = new Size(0x2e, 13);
            this.Label13.Size = size;
            this.Label13.TabIndex = 0x2e;
            this.Label13.Text = "Từ ng\x00e0y";
            this.TxtDenNgay.Format = DateTimePickerFormat.Short;
            point = new Point(0x112, 0x2e);
            this.TxtDenNgay.Location = point;
            this.TxtDenNgay.Name = "TxtDenNgay";
            size = new Size(0x57, 20);
            this.TxtDenNgay.Size = size;
            this.TxtDenNgay.TabIndex = 0x2d;
            this.TxtTuNgay.Format = DateTimePickerFormat.Short;
            point = new Point(90, 0x2e);
            this.TxtTuNgay.Location = point;
            this.TxtTuNgay.Name = "TxtTuNgay";
            size = new Size(0x57, 20);
            this.TxtTuNgay.Size = size;
            this.TxtTuNgay.TabIndex = 0x2c;
            DateTime time = new DateTime(0x7d7, 10, 1, 0, 0, 0, 0);
            this.TxtTuNgay.Value = time;
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x11c, 0xd9);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            size = new Size(0x4f, 0x18);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 0x12;
            this.CmdCancel.Text = "&Tho\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CmdOK.Image = (Image) manager.GetObject("CmdOK.Image");
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0xc9, 0xd9);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x4e, 0x18);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 0x11;
            this.CmdOK.Text = "&Chọn";
            this.CmdOK.UseVisualStyleBackColor = true;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x178, 0xf5);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.CmdCancel);
            this.Controls.Add(this.CmdOK);
            this.Controls.Add(this.GroupBox1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_RptNhapXuatTonKho";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "BC-0022             ";
            this.Text = "BAO CAO NHAP XUAT TON";
            this.GroupBox1.ResumeLayout(false);
            this.GroupBox1.PerformLayout();
            this.GroupBox3.ResumeLayout(false);
            this.GroupBox3.PerformLayout();
            this.GroupBox2.ResumeLayout(false);
            this.GroupBox2.PerformLayout();
            this.ResumeLayout(false);
        }

        public void PrintReportTheoHangHoa()
        {
            this.Cursor = Cursors.WaitCursor;
            DataTable dataTable = this.objPNK.GetDataPrintNhapXuatTonKho(LVYModule.Date2Char(this.TxtTuNgay.Text), LVYModule.Date2Char(this.TxtDenNgay.Text), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboDonVi.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim(), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboKhoHang.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim(), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboNhomHang.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim());
            if (dataTable.Rows.Count == 0)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
            }
            else
            {
                Rpt_NhapXuatTonTheoKho kho = new Rpt_NhapXuatTonTheoKho();
                try
                {
                    kho.SetDataSource(dataTable);
                    if (modGeneral.H_LANGUAGE == "VIET")
                    {
                        kho.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                    }
                    else
                    {
                        kho.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                    }
                    kho.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                    kho.SetParameterValue(2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE);
                    kho.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                    kho.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                    kho.SetParameterValue(5, modGeneral.Tranlated("B\x00c1O C\x00c1O NHẬP XUẤT TỒN", ""));
                    kho.SetParameterValue(6, modGeneral.Tranlated("Từ ng\x00e0y", "") + " : " + this.TxtTuNgay.Text);
                    kho.SetParameterValue(7, modGeneral.Tranlated("Đến ng\x00e0y", "") + " : " + this.TxtDenNgay.Text);
                    kho.SetParameterValue(8, modGeneral.Tranlated("M\x00e3", ""));
                    kho.SetParameterValue(9, modGeneral.Tranlated("T\x00ean", ""));
                    kho.SetParameterValue(10, modGeneral.Tranlated("ĐVT", ""));
                    kho.SetParameterValue(11, modGeneral.Tranlated("Tồn đầu kỳ", ""));
                    kho.SetParameterValue(12, modGeneral.Tranlated("S.lượng", ""));
                    kho.SetParameterValue(13, modGeneral.Tranlated("Gi\x00e1 trị", ""));
                    kho.SetParameterValue(14, modGeneral.Tranlated("Nhập trong kỳ", ""));
                    kho.SetParameterValue(15, modGeneral.Tranlated("Xuất trong kỳ", ""));
                    kho.SetParameterValue(0x10, modGeneral.Tranlated("Tồn cuối kỳ", ""));
                    kho.SetParameterValue(0x11, modGeneral.Tranlated("Tổng cộng", ""));
                    kho.SetParameterValue(0x12, modGeneral.Tranlated("Ng\x00e0y .... th\x00e1ng .... năm ............", ""));
                    kho.SetParameterValue(0x13, modGeneral.Tranlated("Lập biểu", ""));
                    kho.SetParameterValue(20, modGeneral.Tranlated("Kế to\x00e1n trưởng", ""));
                    kho.SetParameterValue(0x15, modGeneral.Tranlated("Gi\x00e1m đốc", ""));
                    MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = kho;
                    MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                    this.Cursor = Cursors.Default;
                    MyProject.Forms.Frm_ViewReport.ShowDialog();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.Cursor = Cursors.Default;
                    MessageBox.Show(exception.Message.ToString());
                    ProjectData.ClearProjectError();
                }
            }
        }

        public void PrintReportTheoKho()
        {
            this.Cursor = Cursors.WaitCursor;
            DataTable dataTable = this.objPNK.GetDataPrintNhapXuatTonKho(LVYModule.Date2Char(this.TxtTuNgay.Text), LVYModule.Date2Char(this.TxtDenNgay.Text), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboDonVi.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim(), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboKhoHang.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim(), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboNhomHang.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim());
            if (dataTable.Rows.Count == 0)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
            }
            else
            {
                Rpt_NhapXuatTonKhoNhom nhom = new Rpt_NhapXuatTonKhoNhom();
                try
                {
                    nhom.SetDataSource(dataTable);
                    if (modGeneral.H_LANGUAGE == "VIET")
                    {
                        nhom.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                    }
                    else
                    {
                        nhom.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                    }
                    nhom.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                    nhom.SetParameterValue(2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE);
                    nhom.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                    nhom.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                    nhom.SetParameterValue(5, modGeneral.Tranlated("B\x00c1O C\x00c1O NHẬP XUẤT TỒN", ""));
                    nhom.SetParameterValue(6, modGeneral.Tranlated("Từ ng\x00e0y", "") + " : " + this.TxtTuNgay.Text);
                    nhom.SetParameterValue(7, modGeneral.Tranlated("Đến ng\x00e0y", "") + " : " + this.TxtDenNgay.Text);
                    nhom.SetParameterValue(8, modGeneral.Tranlated("M\x00e3", ""));
                    nhom.SetParameterValue(9, modGeneral.Tranlated("T\x00ean", ""));
                    nhom.SetParameterValue(10, modGeneral.Tranlated("ĐVT", ""));
                    nhom.SetParameterValue(11, modGeneral.Tranlated("Tồn đầu kỳ", ""));
                    nhom.SetParameterValue(12, modGeneral.Tranlated("S.lượng", ""));
                    nhom.SetParameterValue(13, modGeneral.Tranlated("Gi\x00e1 trị", ""));
                    nhom.SetParameterValue(14, modGeneral.Tranlated("Nhập trong kỳ", ""));
                    nhom.SetParameterValue(15, modGeneral.Tranlated("Xuất trong kỳ", ""));
                    nhom.SetParameterValue(0x10, modGeneral.Tranlated("Tồn cuối kỳ", ""));
                    nhom.SetParameterValue(0x11, modGeneral.Tranlated("Tổng cộng", ""));
                    nhom.SetParameterValue(0x12, modGeneral.Tranlated("Ng\x00e0y .... th\x00e1ng .... năm ............", ""));
                    nhom.SetParameterValue(0x13, modGeneral.Tranlated("Lập biểu", ""));
                    nhom.SetParameterValue(20, modGeneral.Tranlated("Kế to\x00e1n trưởng", ""));
                    nhom.SetParameterValue(0x15, modGeneral.Tranlated("Gi\x00e1m đốc", ""));
                    MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = nhom;
                    MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                    this.Cursor = Cursors.Default;
                    MyProject.Forms.Frm_ViewReport.ShowDialog();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.Cursor = Cursors.Default;
                    MessageBox.Show(exception.Message.ToString());
                    ProjectData.ClearProjectError();
                }
            }
        }

        public void PrintReportTheoNhomHangHoa()
        {
            this.Cursor = Cursors.WaitCursor;
            DataTable dataTable = this.objPNK.GetDataPrintNhapXuatTonKhoTongHop(LVYModule.Date2Char(this.TxtTuNgay.Text), LVYModule.Date2Char(this.TxtDenNgay.Text), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboDonVi.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim(), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboNhomHang.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim());
            if (dataTable.Rows.Count == 0)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
            }
            else
            {
                Rpt_NhapXuatTonKhoTheoNhomHangHoa hoa = new Rpt_NhapXuatTonKhoTheoNhomHangHoa();
                try
                {
                    hoa.SetDataSource(dataTable);
                    if (modGeneral.H_LANGUAGE == "VIET")
                    {
                        hoa.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                    }
                    else
                    {
                        hoa.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                    }
                    hoa.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                    hoa.SetParameterValue(2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE);
                    hoa.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                    hoa.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                    hoa.SetParameterValue(5, modGeneral.Tranlated("B\x00c1O C\x00c1O NHẬP XUẤT TỒN", ""));
                    hoa.SetParameterValue(6, modGeneral.Tranlated("Từ ng\x00e0y", "") + " : " + this.TxtTuNgay.Text);
                    hoa.SetParameterValue(7, modGeneral.Tranlated("Đến ng\x00e0y", "") + " : " + this.TxtDenNgay.Text);
                    hoa.SetParameterValue(8, modGeneral.Tranlated("M\x00e3", ""));
                    hoa.SetParameterValue(9, modGeneral.Tranlated("T\x00ean", ""));
                    hoa.SetParameterValue(10, modGeneral.Tranlated("ĐVT", ""));
                    hoa.SetParameterValue(11, modGeneral.Tranlated("Tồn đầu kỳ", ""));
                    hoa.SetParameterValue(12, modGeneral.Tranlated("S.lượng", ""));
                    hoa.SetParameterValue(13, modGeneral.Tranlated("Gi\x00e1 trị", ""));
                    hoa.SetParameterValue(14, modGeneral.Tranlated("Nhập trong kỳ", ""));
                    hoa.SetParameterValue(15, modGeneral.Tranlated("Xuất trong kỳ", ""));
                    hoa.SetParameterValue(0x10, modGeneral.Tranlated("Tồn cuối kỳ", ""));
                    hoa.SetParameterValue(0x11, modGeneral.Tranlated("Tổng cộng", ""));
                    hoa.SetParameterValue(0x12, modGeneral.Tranlated("Ng\x00e0y .... th\x00e1ng .... năm ............", ""));
                    hoa.SetParameterValue(0x13, modGeneral.Tranlated("Lập biểu", ""));
                    hoa.SetParameterValue(20, modGeneral.Tranlated("Kế to\x00e1n trưởng", ""));
                    hoa.SetParameterValue(0x15, modGeneral.Tranlated("Gi\x00e1m đốc", ""));
                    MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = hoa;
                    MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                    MyProject.Forms.Frm_ViewReport.ShowDialog();
                    this.Cursor = Cursors.Default;
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.Cursor = Cursors.Default;
                    MessageBox.Show(exception.Message.ToString());
                    ProjectData.ClearProjectError();
                }
            }
        }

        public void PrintReportTheoNhomKho()
        {
            this.Cursor = Cursors.WaitCursor;
            DataTable table = this.objPNK.GetDataPrintNhapXuatTonKho(LVYModule.Date2Char(this.TxtTuNgay.Text), LVYModule.Date2Char(this.TxtDenNgay.Text), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboDonVi.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim(), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboKhoHang.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim(), LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboNhomHang.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim());
            if (table.Rows.Count == 0)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
            }
            else
            {
                object obj2;
                if (this.OptDayDu.Checked)
                {
                    obj2 = new Rpt_NhapXuatTonKhoTheoNhomKho();
                }
                else
                {
                    obj2 = new Rpt_NhapXuatTonKhoTheoNhomKhoSoLuong();
                }
                try
                {
                    object[] arguments = new object[] { table };
                    bool[] copyBack = new bool[] { true };
                    NewLateBinding.LateCall(obj2, null, "SetDataSource", arguments, null, null, copyBack, true);
                    if (copyBack[0])
                    {
                        table = (DataTable) Conversions.ChangeType(RuntimeHelpers.GetObjectValue(arguments[0]), typeof(DataTable));
                    }
                    if (modGeneral.H_LANGUAGE == "VIET")
                    {
                        NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, "") }, null, null, null, true);
                    }
                    else
                    {
                        NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, "") }, null, null, null, true);
                    }
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 5, modGeneral.Tranlated("B\x00c1O C\x00c1O NHẬP XUẤT TỒN", "") }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 6, modGeneral.Tranlated("Từ ng\x00e0y", "") + " : " + this.TxtTuNgay.Text }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 7, modGeneral.Tranlated("Đến ng\x00e0y", "") + " : " + this.TxtDenNgay.Text }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 8, modGeneral.Tranlated("M\x00e3", "") }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 9, modGeneral.Tranlated("T\x00ean", "") }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 10, modGeneral.Tranlated("ĐVT", "") }, null, null, null, true);
                    if (this.OptDayDu.Checked)
                    {
                        NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 11, modGeneral.Tranlated("Tồn đầu kỳ", "") }, null, null, null, true);
                    }
                    else
                    {
                        NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 11, modGeneral.Tranlated("SL tồn đầu", "") }, null, null, null, true);
                    }
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 12, modGeneral.Tranlated("S.lượng", "") }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 13, modGeneral.Tranlated("Gi\x00e1 trị", "") }, null, null, null, true);
                    if (this.OptDayDu.Checked)
                    {
                        NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 14, modGeneral.Tranlated("Nhập trong kỳ", "") }, null, null, null, true);
                    }
                    else
                    {
                        NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 14, modGeneral.Tranlated("SL nhập", "") }, null, null, null, true);
                    }
                    if (this.OptDayDu.Checked)
                    {
                        NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 15, modGeneral.Tranlated("Xuất trong kỳ", "") }, null, null, null, true);
                    }
                    else
                    {
                        NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 15, modGeneral.Tranlated("SL xuất", "") }, null, null, null, true);
                    }
                    if (this.OptDayDu.Checked)
                    {
                        NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 0x10, modGeneral.Tranlated("Tồn cuối kỳ", "") }, null, null, null, true);
                    }
                    else
                    {
                        NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 0x10, modGeneral.Tranlated("SL tồn cuối", "") }, null, null, null, true);
                    }
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 0x11, modGeneral.Tranlated("Tổng cộng", "") }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 0x12, modGeneral.Tranlated("Ng\x00e0y .... th\x00e1ng .... năm ............", "") }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 0x13, modGeneral.Tranlated("Lập biểu", "") }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 20, modGeneral.Tranlated("Kế to\x00e1n trưởng", "") }, null, null, null, true);
                    NewLateBinding.LateCall(obj2, null, "SetParameterValue", new object[] { 0x15, modGeneral.Tranlated("Gi\x00e1m đốc", "") }, null, null, null, true);
                    MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = RuntimeHelpers.GetObjectValue(obj2);
                    MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                    this.Cursor = Cursors.Default;
                    MyProject.Forms.Frm_ViewReport.ShowDialog();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    this.Cursor = Cursors.Default;
                    MessageBox.Show(exception.Message.ToString());
                    ProjectData.ClearProjectError();
                }
            }
        }

        private void RbNhomTheoKho_CheckedChanged(object sender, EventArgs e)
        {
            if (this.RbNhomTheoKho.Checked)
            {
                this.CboKhoHang.Enabled = true;
            }
            else
            {
                this.CboKhoHang.SelectedValue = "";
                this.CboKhoHang.Enabled = false;
            }
        }

        private void TxtTuNgay_LostFocus(object sender, EventArgs e)
        {
            if (LVYModule.sRight(this.TxtTuNgay.Text, 7) != LVYModule.sRight(this.TxtDenNgay.Text, 7))
            {
                this.TxtDenNgay.Text = DateTime.DaysInMonth(Conversions.ToInteger(LVYModule.sRight(this.TxtTuNgay.Text, 4)), Conversions.ToInteger(LVYModule.sMid(this.TxtTuNgay.Text, 4, 2))).ToString() + "/" + LVYModule.sRight(this.TxtTuNgay.Text, 7);
            }
        }

        internal virtual ComboBox CboDonVi
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboDonVi;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboDonVi = value;
            }
        }

        internal virtual ComboBox CboKhoHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboKhoHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboKhoHang = value;
            }
        }

        internal virtual ComboBox CboNhomHang
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboNhomHang;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboNhomHang = value;
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual GroupBox GroupBox1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox1 = value;
            }
        }

        internal virtual GroupBox GroupBox2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox2 = value;
            }
        }

        internal virtual GroupBox GroupBox3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox3 = value;
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label13
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label13;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label13 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual Label Label4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label4 = value;
            }
        }

        internal virtual RadioButton OptDayDu
        {
            [DebuggerNonUserCode]
            get
            {
                return this._OptDayDu;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._OptDayDu = value;
            }
        }

        internal virtual RadioButton OptSoLuong
        {
            [DebuggerNonUserCode]
            get
            {
                return this._OptSoLuong;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._OptSoLuong = value;
            }
        }

        internal virtual RadioButton RbNhomTheoHangHoa
        {
            [DebuggerNonUserCode]
            get
            {
                return this._RbNhomTheoHangHoa;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._RbNhomTheoHangHoa = value;
            }
        }

        internal virtual RadioButton RbNhomTheoKho
        {
            [DebuggerNonUserCode]
            get
            {
                return this._RbNhomTheoKho;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.RbNhomTheoKho_CheckedChanged);
                if (this._RbNhomTheoKho != null)
                {
                    this._RbNhomTheoKho.CheckedChanged -= handler;
                }
                this._RbNhomTheoKho = value;
                if (this._RbNhomTheoKho != null)
                {
                    this._RbNhomTheoKho.CheckedChanged += handler;
                }
            }
        }

        internal virtual DateTimePicker TxtDenNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDenNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDenNgay = value;
            }
        }

        internal virtual DateTimePicker TxtTuNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTuNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtTuNgay_LostFocus);
                if (this._TxtTuNgay != null)
                {
                    this._TxtTuNgay.LostFocus -= handler;
                }
                this._TxtTuNgay = value;
                if (this._TxtTuNgay != null)
                {
                    this._TxtTuNgay.LostFocus += handler;
                }
            }
        }
    }
}

